package com.spider.admin.store.primary.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface LogSettingsMapper {
    @Select("select * from t_logs_setting where service_id=#{serviceId}")
    List<Map<String,String>> queryLogSettingsByServiceId(String serviceId);

    @Insert("insert into t_logs_setting(pid,service_id,setting_key,setting_value) values(#{pid},#{serviceId},#{settingKey},#{settingValue})")
    int insertLogSetting(String pid,String serviceId,String settingKey,String settingValue);

    @Delete("delete from t_logs_setting  where service_id=#{serviceId}")
    int deleteLogSettingsByServiceId(String serviceId);

    @Select("SELECT tsm.service_url,tls.service_id,tls.setting_key,tls.setting_value FROM t_service_marks tsm,t_logs_setting tls WHERE tsm.pid=tls.service_id")
    List<Map<String, String>> getAllLogsSettings();
}
